package com.whosly.disclosure.early.handler.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 钉钉消息类型
 */
public enum DingtalkMsgType {
    TEXT("text"),

    ;

    @Getter
    private String type;

    DingtalkMsgType(String type){
        this.type = type;
    }

    public static DingtalkMsgType of(String typeVal) {
        if(StringUtils.isEmpty(typeVal)){
            return null;
        }

        for (DingtalkMsgType dingtalkMsgType : values()) {
            if(StringUtils.equalsIgnoreCase(typeVal, dingtalkMsgType.getType())){
                return dingtalkMsgType;
            }
        }

        return null;
    }

}
